package com.xsm.adapter;

import java.util.ArrayList;

import com.xsm.activitygroup.R;
import com.xsm.adapter.gradviewAdapter.Holder;
import com.xsm.object.PaihangObject;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PaiHangAdapter extends BaseAdapter{
	ArrayList<PaihangObject> list;
	Holder holder;
	Context context;
	public PaiHangAdapter(ArrayList<PaihangObject> list,Context context){
		this.list=list;
		this.context=context;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	public View getView(int arg0, View arg1, ViewGroup arg2) {
		holder=new Holder();
		if(arg1==null){
		arg1=LayoutInflater.from(context).inflate(R.layout.paihangitem, null);
		holder.paixing=(TextView)arg1.findViewById(R.id.paiwei);
		holder.username=(TextView)arg1.findViewById(R.id.username);
		holder.issuecount=(TextView)arg1.findViewById(R.id.issuecount);
		holder.outcount=(TextView)arg1.findViewById(R.id.outcount);
		holder.fenshu=(TextView)arg1.findViewById(R.id.fenshu);
		arg1.setTag(holder);
		}else {
		holder=(Holder)arg1.getTag();	
		}
		holder.paixing.setText(arg0+1+"");
		holder.username.setText(list.get(arg0).user);
		holder.issuecount.setText(list.get(arg0).issuecount);
		holder.fenshu.setText(list.get(arg0).fenshu);
		holder.outcount.setText(list.get(arg0).outcount);
		return arg1;
	}

	
class	Holder{
	TextView outcount;
	TextView username;
	TextView issuecount;
	TextView paixing;
	TextView fenshu;
}

}
